import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

    public static <Date, String> Date parse(String dateStr) {
        try {
            return (Date) sdf.parse((java.lang.String) dateStr);
        } catch (ParseException e) {
            throw new IllegalArgumentException("日期格式错误，正确格式: yyyy-MM-dd HH:mm");
        }
    }

    public static String format(Date date) {
        return sdf.format(date);
    }
}